//package com.dji.sdk.self.internal.controller;
//
//import androidx.annotation.NonNull;
//import androidx.annotation.Nullable;
//import androidx.appcompat.app.ActionBarDrawerToggle;
//import androidx.appcompat.app.AlertDialog;
//import androidx.appcompat.widget.Toolbar;
//import androidx.drawerlayout.widget.DrawerLayout;
//
//import android.content.ComponentName;
//import android.content.DialogInterface;
//import android.content.Intent;
//import android.content.ServiceConnection;
//import android.content.SharedPreferences;
//import android.os.AsyncTask;
//import android.os.Bundle;
//import android.os.Handler;
//import android.os.HandlerThread;
//import android.os.IBinder;
//import android.os.Message;
//import android.text.TextUtils;
//import android.util.Log;
//import android.view.MenuItem;
//import android.view.View;
//import android.widget.Button;
//import android.widget.ImageView;
//import android.widget.LinearLayout;
//import android.widget.TextView;
//import com.amap.api.maps2d.AMap;
//import com.amap.api.maps2d.AMapOptions;
//import com.amap.api.maps2d.CameraUpdate;
//import com.amap.api.maps2d.CameraUpdateFactory;
//import com.amap.api.maps2d.MapView;
//import com.amap.api.maps2d.UiSettings;
//import com.amap.api.maps2d.model.BitmapDescriptorFactory;
//import com.amap.api.maps2d.model.LatLng;
//import com.amap.api.maps2d.model.MarkerOptions;
//import com.dji.sdk.self.R;
//import com.dji.sdk.self.internal.connection.SendHttp;
//import com.dji.sdk.self.internal.services.SendService;
//import com.dji.sdk.self.internal.model.UavCondition;
//import com.dji.sdk.self.internal.utils.ServiceUtils;
//import com.dji.sdk.self.internal.utils.ToastUtils;
////import com.ejlchina.okhttps.HttpResult;
//import com.google.android.material.navigation.NavigationView;
//import com.squareup.otto.Subscribe;
//
//import java.io.IOException;
//import java.util.concurrent.atomic.AtomicBoolean;
//
//import dji.common.error.DJIError;
//import dji.common.error.DJISDKError;
//import dji.common.realname.AppActivationState;
//import dji.common.useraccount.UserAccountState;
//import dji.common.util.CommonCallbacks;
//import dji.log.DJILog;
//import dji.sdk.base.BaseComponent;
//import dji.sdk.base.BaseProduct;
//import dji.sdk.battery.Battery;
//import dji.sdk.flightcontroller.FlightController;
//import dji.sdk.flightcontroller.RTK;
//import dji.sdk.products.Aircraft;
//import dji.sdk.realname.AppActivationManager;
//import dji.sdk.remotecontroller.RemoteController;
//import dji.sdk.sdkmanager.DJISDKInitEvent;
//import dji.sdk.sdkmanager.DJISDKManager;
//import dji.sdk.useraccount.UserAccountManager;
//import okhttp3.Response;
//
//import static java.lang.Thread.sleep;
//
///**
// * 连接无人机数据回传
// * 高德地图显示
// */
//public class GaodeMapActivity extends BaseActivity implements AMap.OnMapClickListener {
//    private static final String TAG = GaodeMapActivity.class.getSimpleName();
//
//    //地图
//    private MapView mapView;
//    private AMap aMap;
//    private MarkerOptions markerOptions;
//
//    //控件
//    private ImageView ivDown;
//    private TextView tvUavName,tvUserRole;
//    private LinearLayout info,allinfo;
//    private DrawerLayout mDrawerLayout;
//    private Toolbar mToolbar;
//    private NavigationView mNavigationView;
//    private Button btnLogin;
//    private TextView tvInstantCurrent;
//    AlertDialog dialog = null;
//
//
//
//    private LatLng nanjing ;
//    private double latitude = 32 ;
//    private double longitude = 181;
//
//    //回传的数据
//    private double pitch;
//    private double roll;
//    private double yaw;
//    private double height;
//    private float distance;
//    private double horizontalSpeed;
//    private float verticalSpeed;
//    private int voltage;
//    private int current;
//    private float batteryTemp;
//    private int batteryCapacity;//电池容量
//    private int uavPower;//飞机电量
//    private int remotePower;
//    private int remoteSignal;
//    private int graphSignal;
//    private String serialNumber;
//    private UavCondition condition;
//    private boolean isFirst = true;
//
//
//
//
//    //无人机需要获取的数据所需对象
//    private static BaseProduct mProduct;
//    private FlightController mFlightController;//
//    private Battery battery;//电池
//    private RemoteController remoteController;//遥控器
//    private RTK rtk;
//    private Aircraft aircraft ;
//
//
//
//    private AtomicBoolean isRegistrationInProgress = new AtomicBoolean(false);
//
//
//
//    //处理注册登录
//    private SharedPreferences token;
//    private SharedPreferences.Editor editor;
//    private String loginToken;
//    private long freshTokenAt,accessTokenAt;
//    private long now;
//    private String name;
//    private boolean isLogin = false;
//
//
//    //大疆账号注册登录
//    private Handler mHandler;
//    private AtomicBoolean hasAppActivationListenerStarted = new AtomicBoolean(false);
//    private static final int MSG_INFORM_ACTIVATION = 1;
//    private static final int ACTIVATION_DALAY_TIME = 3000;
//    private AppActivationState.AppActivationStateListener appActivationStateListener;
//    private HandlerThread mHandlerThread = new HandlerThread("Bluetooth");
//
//    private BaseComponent.ComponentListener mDJIComponentListener = new BaseComponent.ComponentListener() {
//
//        @Override
//        public void onConnectivityChange(boolean isConnected) {
//            Log.d(TAG, "onComponentConnectivityChanged: " + isConnected);
//        }
//    };
//
//
//
//
//    //数据回传服务
//    SendService sendService;
//    Intent sendServiceIntent;
//    private SendService.MyBinder myBinder=null;
//    private SendHttp sendHttp;
//    private boolean isBind = false;
//
//    //获取无人机
//    public static synchronized BaseProduct getProductInstance() {
//        if (null == mProduct) {
//            mProduct = DJISDKManager.getInstance().getProduct();
//        }
//        return mProduct;
//    }
//
//
//    private ServiceConnection sendconn = new ServiceConnection() {
//        @Override
//        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
//            myBinder = (SendService.MyBinder) iBinder;
//            sendService = myBinder.getService();
//            sendService.setCallback(new SendService.CallBack() {
//                @Override
//                public void onDataChanged(UavCondition uavCondition) {
//                    latitude = uavCondition.getLatitude();
//                    longitude = uavCondition.getLongitude();
//                    current = uavCondition.getCurrent();
//                    Log.i("GaodeMapActivity","latitude: "+String.valueOf(latitude)+" longitude: "+longitude+"current:"+uavCondition.getCurrent());
//                    Message msg = new Message();
//                    msg.what=100;
//                    sendHandler.sendMessage(msg);
//                    updateDroneLocation();
//                }
//            });
//        }
//
//        @Override
//        public void onServiceDisconnected(ComponentName componentName) {
//            Log.i("lifecycle","sendservice disconnect");
//        }
//    };
//
//
//
//    private Handler sendHandler =  new Handler(){
//        @Override
//        public void handleMessage(Message msg) {
//            super.handleMessage(msg);
//            if (msg.what == 100){
//                Log.i("GaodeMapActivity","current:"+latitude);
//                tvInstantCurrent.setText(String.valueOf(current));
//            }
//        }
//    };;
//
//
//    private Handler handlerUI = new Handler(){
//        @Override
//        public void handleMessage(Message msg) {
//            super.handleMessage(msg);
//            if(msg.what == 100){
//                bindService(sendServiceIntent,sendconn,BIND_AUTO_CREATE);
//                isBind = true;
//            }
//        }
//    };
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_gaode_map);
//        DJISampleApplication.getEventBus().register(this);
//        mapView = findViewById(R.id.gaode_mapview);
//        mapView.onCreate(savedInstanceState);
//
//        ivDown = findViewById(R.id.draw_up);
//        info = findViewById(R.id.uav_info);
//        allinfo = findViewById(R.id.uav_allinfo);
////        allinfo.getBackground().setAlpha(200);
//        tvUavName = findViewById(R.id.tv_is_connect_uav);
//        tvInstantCurrent = findViewById(R.id.part_info).findViewById(R.id.instant_current);
//        mDrawerLayout = findViewById(R.id.drawer_layout);
//        mToolbar = findViewById(R.id.gaode_toolbar);
//        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,mDrawerLayout,mToolbar,R.string.drawer_layout,R.string.drawer_layout);
//        mDrawerLayout.addDrawerListener(toggle);
//        toggle.setDrawerIndicatorEnabled(true);
//        toggle.syncState();
//        aircraft =  DJISampleApplication.getAircraftInstance();
//        Log.i("LoginActivity","onCreate"+aircraft);
//
//        initNavigationHeader();
//        sendServiceIntent = new Intent(GaodeMapActivity.this, SendService.class);
//        sendHttp = new SendHttp(this);
//        btnLogin = findViewById(R.id.btn_uxsdk);
//
//
//        btnLogin.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                //打开飞行视频界面
//                Intent intent = new Intent(GaodeMapActivity.this,UXSDKActivity.class);
//                startActivity(intent);
//
//            }
//        });
//
//        ivDown.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                int isVisible = info.getVisibility();
//                if(isVisible>0){
//                    info.setVisibility(View.VISIBLE);
//                    ivDown.setImageResource(R.drawable.ic_arrow_up_bold);
//                }else {
//                    info.setVisibility(View.GONE);
//                    ivDown.setImageResource(R.drawable.ic_arrow_down);
//                }
//                ivDown.setFocusable(true);
//                info.setFocusable(true);
//            }
//        });
//
//        nanjing = new LatLng(32.041544,118.767413);
//        markerOptions = new MarkerOptions().position(nanjing).title("Marker in Chinatelecom");
//        initMapView();
//        startSDKRegistration();
//    }
//
//    void startLiveShow() {
//        SharedPreferences preferences = getSharedPreferences("LiveStreamUrl",0);
//        String temp = preferences.getString("liveUrl",null);
//        String streamUrl = null;
//        if(!TextUtils.isEmpty(temp)) {
//            streamUrl = temp;
//        }
//
//        if (!isLiveStreamManagerOn()) {
//            return;
//        }
//        if (DJISDKManager.getInstance().getLiveStreamManager().isStreaming()) {
//            ToastUtils.setResultToToast("already started!");
//            return;
//        }
//
//        String finalStreamUrl = streamUrl;
//        Log.i("UXSDKActivity",finalStreamUrl);
//        new Thread() {
//            @Override
//            public void run() {
//
//                DJISDKManager.getInstance().getLiveStreamManager().setLiveUrl(finalStreamUrl);
//                int result = DJISDKManager.getInstance().getLiveStreamManager().startStream();
//                DJISDKManager.getInstance().getLiveStreamManager().setStartTime();
//                ToastUtils.setResultToToast("startLive:" + result +
//                        "\n isVideoStreamSpeedConfigurable:" + DJISDKManager.getInstance().getLiveStreamManager().isVideoStreamSpeedConfigurable() +
//                        "\n isLiveAudioEnabled:" + DJISDKManager.getInstance().getLiveStreamManager().isLiveAudioEnabled());
//                Log.i("UXSDKActivity","startLive:" + result +
//                        "\n isVideoStreamSpeedConfigurable:" + DJISDKManager.getInstance().getLiveStreamManager().isVideoStreamSpeedConfigurable() +
//                        "\n isLiveAudioEnabled:" + DJISDKManager.getInstance().getLiveStreamManager().isLiveAudioEnabled());
//            }
//        }.start();
//    }
//
//    private boolean isLiveStreamManagerOn() {
//        if (DJISDKManager.getInstance().getLiveStreamManager() == null) {
//            ToastUtils.setResultToToast("No live stream manager!");
//            return false;
//        }
//        return true;
//    }
//
//    public void initNavigationHeader(){
//        mNavigationView = findViewById(R.id.navigation_view_left);
//        View headerView = mNavigationView.getHeaderView(0);
//        tvUserRole = headerView.findViewById(R.id.tv_user_role);
//        token = getSharedPreferences("LoginToken",0);
//        now = System.currentTimeMillis()+6000;
//        name = token.getString("username",null);
//        loginToken = token.getString("loginToken",null);
//        freshTokenAt = token.getLong("refreshTokenExpiresAt",0);
//        accessTokenAt = token.getLong("accessTokenExpiresAt",0);
//        if(token==null||loginToken==null||now>freshTokenAt){
//            isLogin = false;
//        }else{
//            isLogin = true;
//        }
//        ToastUtils.setResultToToast("isLogin:"+isLogin);
//        mNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
//            @Override
//            public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
//                switch (menuItem.getItemId()){
//                    case R.id.facility_manager:
//                        ToastUtils.showToast("facilityManager");
//                        break;
//                    case R.id.personal_center:
//                        mDrawerLayout.closeDrawers();
//                        startActivityForResult(new Intent(GaodeMapActivity.this,LoginActivity.class),2);
////                        startActivity(new Intent(getApplicationContext(),LoginActivity.class));
//
//                        break;
//                    case R.id.data_statics:
//                        break;
//                    case R.id.flight_plan:
//                        break;
//                    case R.id.offline_map:
//                        mDrawerLayout.closeDrawers();
//                        startActivity(new Intent(GaodeMapActivity.this,
//                                OfflineMapActivity.class));
//
//                        break;
//                    case R.id.setting_live_stream_url:
//                        //打开获取推流地址界面
//                        mDrawerLayout.closeDrawers();
//                        Intent intent = new Intent(GaodeMapActivity.this, GetLiveStreamUrlActivity.class);
//                        startActivity(intent);
//                        break;
//                    default:break;
//                }
//                return true;
//            }
//        });
//
//    }
//
//    @Override
//    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
//        switch (requestCode){
//            case 1:break;
//            case 2:
//                if(resultCode==200){
//                    ToastUtils.setResultToToast("登录成功");
//                    String username = data.getStringExtra("username");
//                    isLogin = data.getBooleanExtra("login",false);
//                    if(isLogin==true){
//                        name = username;
//                    }
//                }else if(resultCode == 100){
//                    isLogin = false;
//                    name=null;
//                }
//        }
//        super.onActivityResult(requestCode, resultCode, data);
//
//        if(aMap==null){
//            aMap = mapView.getMap();
//        }
//
////
////        //数据回传
////        Message message = new Message();
////        message.what = 100;
////        handler.sendMessage(message);
//
//    }
//    public void initMapView(){
//        if (aMap == null) {
//            ToastUtils.showToast("initMapView");
//            aMap = mapView.getMap();
//            aMap.getMaxZoomLevel();
//            UiSettings settings = aMap.getUiSettings();
//            settings.setZoomControlsEnabled(false);
//            settings.setLogoPosition(AMapOptions.LOGO_POSITION_BOTTOM_LEFT);
//            aMap.setOnMapClickListener(this);// add the listener for click for amap object
//
//        }
//        aMap.addMarker(markerOptions);
//        aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(nanjing,18));
//
//
//
//    }
//
//    private void updateDroneLocation(){
//        LatLng pos = new LatLng(latitude, longitude);
//        //Create MarkerOptions object
//        final MarkerOptions markerOptions = new MarkerOptions();
//        markerOptions.position(pos);
//        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.aircraft));
//
//        runOnUiThread(new Runnable() {
//            @Override
//            public void run() {
//                if(checkGpsCoordination(latitude,longitude)){
//                    cameraUpdate();
//                }
//            }
//        });
//    }
//
//    public static boolean checkGpsCoordination(double latitude, double longitude) {
//        return (latitude > -90 && latitude < 90 && longitude > -180 && longitude < 180) && (latitude != 0f && longitude != 0f);
//    }
//    private void cameraUpdate(){
//        LatLng pos = new LatLng(latitude, longitude);
//        float zoomlevel = (float) 18.0;
//        CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(pos, zoomlevel);
//        aMap.moveCamera(cu);
//
//    }
//
//
//    private void sendDelayMsg(int msg, long delayMillis) {
//        if (mHandler == null){
//            return;
//        }
//
//        if (!mHandler.hasMessages(msg)) {
//            mHandler.sendEmptyMessageDelayed(msg, delayMillis);
//        }
//    }
//
//
//    private void startSDKRegistration() {
//        if (isRegistrationInProgress.compareAndSet(false, true)) {
//            AsyncTask.execute(new Runnable() {
//                @Override
//                public void run() {
//                    ToastUtils.setResultToToast(GaodeMapActivity.this.getString(R.string.sdk_registration_doing_message));
//                    DJISDKManager.getInstance().registerApp(GaodeMapActivity.this.getApplicationContext(), new DJISDKManager.SDKManagerCallback() {
//                        @Override
//                        public void onRegister(DJIError djiError) {
//                            if (djiError == DJISDKError.REGISTRATION_SUCCESS) {
//                                DJILog.e("App registration", DJISDKError.REGISTRATION_SUCCESS.getDescription());
//                                DJISDKManager.getInstance().startConnectionToProduct();
//                                ToastUtils.setResultToToast(GaodeMapActivity.this.getString(R.string.sdk_registration_success_message));
//                            } else {
//                                ToastUtils.setResultToToast(GaodeMapActivity.this.getString(R.string.sdk_registration_message) + djiError.getDescription());
//                            }
//                            Log.v(TAG, djiError.getDescription());
////                            hideProcess();
//                        }
//                        @Override
//                        public void onProductDisconnect() {
//                            Log.d(TAG, "onProductDisconnect");
//                            if(isBind){
//                                unbindService(sendconn);
//                            }
//
//
//                        }
//                        @Override
//                        public void onProductConnect(BaseProduct baseProduct) {
//                            Log.d(TAG, String.format("onProductConnect newProduct:%s", baseProduct));
//                            aircraft = (Aircraft) baseProduct;
//                            if(baseProduct instanceof Aircraft){
//                                Log.i("LoginActivity","onResume "+aircraft);
//                                Message message = new Message();
//                                message.what = 100;
//                                handlerUI.sendMessage(message);
//                                startLiveShow();
//                                tvUavName.setText(aircraft.getModel().getDisplayName());
//                                btnLogin.setEnabled(true);
//                            }
//
//
//                        }
//
//                        @Override
//                        public void onProductChanged(BaseProduct baseProduct) {
//                        }
//
//                        @Override
//                        public void onComponentChange(BaseProduct.ComponentKey componentKey,
//                                                      BaseComponent oldComponent,
//                                                      BaseComponent newComponent) {
//                            if (newComponent != null) {
//                                newComponent.setComponentListener(mDJIComponentListener);
//                            }
//                            Log.d(TAG,
//                                    String.format("onComponentChange key:%s, oldComponent:%s, newComponent:%s",
//                                            componentKey,
//                                            oldComponent,
//                                            newComponent));
//
//                        }
//
//                        @Override
//                        public void onInitProcess(DJISDKInitEvent djisdkInitEvent, int i) {
//
//                        }
//
//                        @Override
//                        public void onDatabaseDownloadProgress(long current, long total) {
//                        }
//                    });
//                }
//            });
//        }
//    }
//
//    private void initUavCondition(Aircraft aircraft) {
//
//    }
//
//    private void notifyStatusChange() {
//        DJISampleApplication.getEventBus().post(new ConnectivityChangeEvent());
//        Log.i("GaodeMapActivity","notifyStatusChange");
//    }
//
//    @Subscribe
//    public void onConnectivityChange(ConnectivityChangeEvent event) {
//        Log.i("GaodeMapActivity","onConnectivityChange");
//    }
//
//    private void addAppActivationListenerIfNeeded() {
//        if (AppActivationManager.getInstance().getAppActivationState() != AppActivationState.ACTIVATED) {
//            sendDelayMsg(MSG_INFORM_ACTIVATION, ACTIVATION_DALAY_TIME);
//            if (hasAppActivationListenerStarted.compareAndSet(false, true)) {
//                appActivationStateListener = new AppActivationState.AppActivationStateListener() {
//
//                    @Override
//                    public void onUpdate(AppActivationState appActivationState) {
//                        if (mHandler != null && mHandler.hasMessages(MSG_INFORM_ACTIVATION)) {
//                            mHandler.removeMessages(MSG_INFORM_ACTIVATION);
//                        }
//                        if (appActivationState != AppActivationState.ACTIVATED) {
//                            sendDelayMsg(MSG_INFORM_ACTIVATION, ACTIVATION_DALAY_TIME);
//                        }
//                    }
//                };
//                AppActivationManager.getInstance().addAppActivationStateListener(appActivationStateListener);
//            }
//        }
//    }
//
//    private void removeAppActivationListenerIfNeeded() {
//        if (hasAppActivationListenerStarted.compareAndSet(true, false)) {
//            AppActivationManager.getInstance().removeAppActivationStateListener(appActivationStateListener);
//        }
//    }
//    private void loginToActivationIfNeeded() {
//        if (AppActivationManager.getInstance().getAppActivationState() == AppActivationState.LOGIN_REQUIRED) {
//            UserAccountManager.getInstance()
//                    .logIntoDJIUserAccount(getApplicationContext(),
//                            new CommonCallbacks.CompletionCallbackWith<UserAccountState>() {
//                                @Override
//                                public void onSuccess(UserAccountState userAccountState) {
//                                    ToastUtils.setResultToToast("Login Successed!");
//                                }
//
//                                @Override
//                                public void onFailure(DJIError djiError) {
//                                    ToastUtils.setResultToToast("Login Failed!");
//                                }
//                            });
//        }
//    }
////
//    @Override
//    public void onAttachedToWindow() {
//        Log.i("LoginActivity", "Comes into the onAttachedToWindow");
//        super.onAttachedToWindow();
//    }
//
//
//    @Override
//    protected void onSaveInstanceState(Bundle outState) {
//        super.onSaveInstanceState(outState);
//        //在activity执行onSaveInstanceState时执行mMapView.onSaveInstanceState (outState)，保存地图当前的状态
//        mapView.onSaveInstanceState(outState);
//    }
//
//    @Override
//    public void onBackPressed() {
//
//        Log.i("lifecycle","onBackPressed");
//        AlertDialog.Builder builder =  new AlertDialog.Builder(GaodeMapActivity.this).setTitle("提示").setMessage("是否退出APP?")
//                .setPositiveButton("确定", new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialogInterface, int i) {
////                        MainActivity.mainActivity.finish();
//                        ActivityController.finishAll();
//                    }
//                })
//                .setNegativeButton("取消", new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialogInterface, int i) {
//                        return;
//                    }
//                })
//                .setCancelable(true);
//        dialog = builder.create();
//        if(!isFinishing()){
//            dialog.show();
//        }
//
//
//
//    }
//    @Override
//    protected void onDestroy() {
//
//        Log.i("lifecycle", "onDestroy");
//        removeAppActivationListenerIfNeeded();
//        DJISampleApplication.getEventBus().unregister(this);
//        mapView.onDestroy();
//        if (isBind){
//            unbindService(sendconn);
//            isBind = false;
//        }
//
//
//        if(dialog!=null&&dialog.isShowing()){
//            dialog.dismiss();
//        }
//        super.onDestroy();
//
//    }
//    @Override
//    protected void onResume() {
//        super.onResume();
//        //在activity执行onResume时执行mMapView.onResume ()，重新绘制加载地图
//        mapView.onResume();
//        Log.i("LoginActivity","onResume");
//        if(DJISDKManager.getInstance().hasSDKRegistered()){
//            Log.i("GaodeMapActivity","hasRegistered");
//        }
//        if(isLogin == true){
//            tvUserRole.setText(name);
////
//
////            if(aircraft!=null&&aircraft.isConnected()){
////                ToastUtils.setResultToToast("aircraft:"+mProduct.isConnected());
////                tvUavName.setText(mProduct.getModel().getDisplayName());
////                btnLogin.setEnabled(true);
////            }else{
////                ToastUtils.setResultToToast("Disconnect");
////                btnLogin.setEnabled(false);
////            }
//
//
//        }else{
//            tvUserRole.setText("未登录");
//            ToastUtils.setResultToToast("请先登录");
//        }
//    }
//    @Override
//    protected void onPause() {
//        super.onPause();
//        //在activity执行onPause时执行mMapView.onPause ()，暂停地图的绘制
//        mapView.onPause();
//    }
//
//    @Override
//    public void onMapClick(LatLng latLng) {
//
//    }
//
//
//    @Override
//    protected void onStop() {
//        super.onStop();
//    }
//    public static class ConnectivityChangeEvent {
//
//    }
//}